﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace PromotionApp.Utility
{
    public class DateTimeHelper
    {
        #region Private Variable

        public static string GetFormatedDateTime(int value)
        {
            string result = value < 10 ? string.Format("0{0}", value.ToString()) : value.ToString();

            return result;
        }

        #endregion

        #region Public Method

        public static string GetDateTimePrefix()
        {
            string result = string.Empty;
            DateTime dt = DateTime.Now;
            string year = dt.Year.ToString();
            string month = GetFormatedDateTime(dt.Month);
            string day = GetFormatedDateTime(dt.Day);
            string hour = GetFormatedDateTime(dt.Hour);
            string minute = GetFormatedDateTime(dt.Minute);
            string second = GetFormatedDateTime(dt.Second);

            result = string.Format("{0}{1}{2}{3}{4}{5}", year, month, day, hour, minute, second);

            return result;
        }

        #endregion
    }
}